import { LoginAction } from "@/types/store"
import { LoginToken } from "@/types/data"
import { getToken } from "@/utils/storage"


const initialState:LoginToken = getToken()
// console.log(initialState,'initialState');

const login = (state = initialState, action: LoginAction):LoginToken => {
    switch(action.type){
        case 'login/GET_LOGIN':
            return action.payload
        case 'login/OUT_LOGIN':
          return initialState
        case 'login/token':
            return action.payload
        default:
            return state
    }
    
}

export default login

